package com.cocolove2.library_cocodialog.animations.Attention;

import android.animation.ObjectAnimator;
import android.view.View;
import android.view.animation.CycleInterpolator;

import com.cocolove2.library_cocodialog.animations.BaseAnimatorEffects;

public class ShakeHorizontal extends BaseAnimatorEffects {
    public ShakeHorizontal() {
        mDuration = 1000;
    }

    @Override
    public void setupAnimator(View view) {
        ObjectAnimator animator = ObjectAnimator.ofFloat(view, "translationX", -10, 10);
        animator.setInterpolator(new CycleInterpolator(5));
        mAnimatorSet.playTogether(animator);

        /**
         * <pre>
         *  另一种shake实现
         * ObjectAnimator.ofFloat(view, "translationX", 0, 25, -25, 25, -25, 15, -15, 6, -6, 0);
         * </pre>
         */
    }
}
